home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / plotting / gnuplot3.lzh / gnuplot / term / bigfig.trm < prev    next >
Encoding:
Text File  |  1991-08-26  |  3.5 KB  |  124 lines

  1. /* GNUPLOT - fig.trm */
  2. /*
  3.  * Copyright (C) 1990
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted,
  7.  * provided that the above copyright notice appear in all copies and
  8.  * that both that copyright notice and this permission notice appear
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed
  13.  * as patches to released version.
  14.  *
  15.  * This software  is provided "as is" without express or implied warranty.
  16.  *
  17.  * This file is included by ../term.c.
  18.  *
  19.  * This terminal driver supports:
  20.  *  Fig graphics language
  21.  *
  22.  * AUTHORS
  23.  *  Micah Beck, David Kotz
  24.  *
  25.  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  26.  *
  27.  */
  28.  
  29. /*
  30.  * Original for Fig code output by Micah Beck, 1989
  31.  * Department of Computer Science, Cornell University
  32.  * Updated by David Kotz for gnuplot 2.0
  33.  * More efficient output by Ian Dall
  34.  * Increased size of plot by Ian Dall
  35.  */
  36.  
  37. #define BFIG_HTIC       (7*FIG_RES/80)
  38. #define BFIG_VTIC       (7*FIG_RES/80)
  39. #define BFIG_HCHAR      (9*FIG_RES/80)
  40. #define BFIG_FONT_S     (16)
  41. #define BFIG_VCHAR      ((BFIG_FONT_S)*FIG_RES/80)  /* height in pixels of font
  42.         */
  43.  
  44. #define BFIG_ARROW_WIDTH BFIG_HTIC
  45. #define BFIG_ARROW_HEIGHT BFIG_HTIC
  46.  
  47.  
  48.  
  49. /* 7 inches wide by 5 inches high */
  50. #define BFIG_XMAX (8 * FIG_RES)
  51. #define BFIG_YMAX (5 * FIG_RES)
  52.  
  53. #define BFIG_XOFF (FIG_RES/2)
  54. #define BFIG_YOFF (FIG_RES/2)
  55.  
  56.  
  57. BFIG_vector(ux,uy)
  58.      unsigned int ux,uy;
  59. {
  60.   int x=ux, y=uy;
  61.  
  62.   if (FIG_polyvec_stat != FIG_poly_part)
  63.     {
  64.       fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  65.               O_POLYLINE, T_POLYLINE,
  66.               FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  67.               0, 0);
  68.       fprintf(outfile, "%d %d",
  69.               BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
  70.       FIG_poly_vec_cnt = 1;
  71.       FIG_polyvec_stat = FIG_poly_part;
  72.     }
  73.   fprintf(outfile, " %d %d",
  74.           BFIG_XOFF +  x, BFIG_YMAX + BFIG_YOFF-y);
  75.   FIG_poly_vec_cnt++;
  76.   if (FIG_poly_vec_cnt > 50)
  77.     FIG_poly_clean(FIG_polyvec_stat);
  78.  
  79.   FIG_posx = x;
  80.   FIG_posy = y;
  81. }
  82.  
  83.  
  84.  
  85.  
  86. BFIG_arrow(sx, sy, ex, ey, head)
  87.         int sx, sy;     /* start coord */
  88.         int ex, ey;     /* end coord */
  89.     BOOLEAN head;
  90. {
  91.     FIG_poly_clean(FIG_polyvec_stat);
  92.         fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  93.                 O_POLYLINE, T_POLYLINE,
  94.                 FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  95.                 head ? 1 : 0, 0);
  96.         /* arrow line */
  97.     if ( head )
  98.         fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  99.                     0, 0, 1.0,
  100.             (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
  101.         fprintf(outfile, "%d %d %d %d 9999 9999\n",
  102.                 BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
  103.         BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
  104.  
  105.         FIG_posx = ex;
  106.         FIG_posy = ey;
  107. }
  108.  
  109. BFIG_put_text(x, y, str)
  110.         int x, y;
  111.         char *str;
  112. {
  113.   if (strlen(str) == 0) return;
  114.   FIG_poly_clean(FIG_polyvec_stat);
  115.     y = y - BFIG_VCHAR/2;               /* assuming vertical center justified */
  116.  
  117.     fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  118.                   O_TEXT, FIG_justify,
  119.                   FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
  120.                   1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
  121.         BFIG_YMAX + BFIG_YOFF-y, str);
  122. }
  123.  
  124.